package com.ai.flight.ai.service;

import org.springframework.ai.chat.client.ChatClientRequest;
import org.springframework.ai.chat.client.ChatClientResponse;
import org.springframework.ai.chat.client.advisor.api.AdvisorChain;
import org.springframework.ai.chat.client.advisor.api.BaseAdvisor;

/**
 * @Author: suren@517na.com
 * @CreateTime: 2025-06-02
 * @Description: 对话记录拦截器，拦截对话，得不到结果时，可以看日志进行分析
 */

public class LoggingAdvisor implements BaseAdvisor {
    @Override
    public int getOrder() {
        return 999;
    }

    @Override
    public ChatClientRequest before(ChatClientRequest chatClientRequest, AdvisorChain advisorChain) {
        System.out.println(chatClientRequest);
        return chatClientRequest;
    }

    @Override
    public ChatClientResponse after(ChatClientResponse chatClientResponse, AdvisorChain advisorChain) {
        return chatClientResponse;
    }
}
